<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">点击</button>
    <script src="../../es6代码/jquery/jquery-1.12.4.min.js"></script>
    <script>
        let p1 = new Promise((resolve,reject)=>{
            if(true){
                resolve(1);
            }else{
                reject(2);
            }
        })
        //只传成功的值，不成功不传值
        $(".btn").click(async()=>{
            let result = await p1;
            console.log(result);
        })
    </script>
</body>
</html>